package org.karelun.gef.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.karelun.gef.helper.ConstantMessages;
import org.karelun.gef.helper.IDConstant;

public class ShowPartAction extends Action{
	
	private IWorkbenchWindow window;
	
	public ShowPartAction(IWorkbenchWindow window){
		this.window=window;
		setId(IDConstant.ShowPartAction_Id);
		setText(ConstantMessages.ShowPart);
	}
	
	public void run(){
		if(window==null)
			return ;
		try {
			window.getActivePage().showView(IDConstant.showPartViewId);
		} catch (PartInitException e) {
			e.printStackTrace();
		}
	}
}
